/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package player;

import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.*;
import javax.swing.JScrollPane;

public class player extends JFrame {

    private static final long serialVersionUID = 1L;
    private String[] column1 = {"Number", "Name", "Artist", "Duration", "Album", "Year"};
    private Object[][] p1;
    private JPanel jContentPane = null;
    private JPanel jPanel = null;
    private JTabbedPane jTabbedPane = null;
    private JPanel jPanel1 = null;//the songInf panel
    private DefaultTableModel t1 = null;
    private JLabel jLabel1 = null;
    private JTextField sname1 = null;
    private JButton searchbtn = null;
    private JButton deletebtn = null;
    private JTable jTable1 = null;
    private JScrollPane jScrollPane1 = null;
    //here is a addSong panel
    private JPanel jPanel2 = null;
    private JLabel jLabel2 = null;
    private JLabel jLabel3 = null;
    private JLabel jLabel4 = null;
    private JLabel jLabel5 = null;
    private JLabel jLabel6 = null;
    private JLabel jLabel7 = null;
    private JTextField number = null;
    private JTextField sname2 = null;
    private JTextField artist = null;
    private JTextField duration = null;
    private JTextField album = null;
    private JTextField year = null;
    private JButton addbtn = null;
    private JButton resetbtn = null;
    //here is the jpanel3
    private JPanel jPanel3 = null;
    private JLabel jLabel8 = null;
    private JLabel jLabel9 = null;
    private JLabel jLabel10 = null;
    private JLabel jLabel11 = null;
    private JLabel jLabel12 = null;
    private JTextField sname3 = null;
    private JButton selectbtn = null;
    private JTextField artist1 = null;
    private JTextField sname4 = null;
    private JTextField album1 = null;
    private JTextField year1 = null;
    private JTable jTable2 = null;
    private JButton editbtn = null;
    private JButton exitbtn = null;
    private JScrollPane jScrollPane3 = null;
    private Object[][] p3;
    private DefaultTableModel t3 = null;
    private String[] column3 = {"Number", "Name", "Artist", "Duration", "Album", "Year"};

    /**
     * This method initializes jPanel
     * @return java.swing.JPanel
     */
    private JPanel getJPanel() {
        if (jPanel == null) {
            jPanel = new JPanel();
            jPanel.setLayout(new GridBagLayout());
            jPanel.setBounds(new Rectangle(0, 0, 512, 0));
        }
        return jPanel;
    }

    /**
     * This method initializes jTabbedPane
     * @return java.swing.JTabbedPane
     */
    private JTabbedPane getJTabbedPane() {
        if (jTabbedPane == null) {
            jTabbedPane = new JTabbedPane();
            jTabbedPane.setBounds(new Rectangle(-1, 0, 600, 345));
            jTabbedPane.addTab("SongInfo", null, getJPanel1(), null);
            jTabbedPane.addTab("Add song", null, getJPanel2(), null);
            jTabbedPane.addTab("Edit song", null, getJPanel3(), null);
        }
        return jTabbedPane;
    }

    /**
     * This method initializes jPanel1 for songInformation
     * @return java.swing.JPanel
     */
    private JPanel getJPanel1() {
        if (jPanel1 == null) {
            jLabel1 = new JLabel();
            jLabel1.setBounds(new Rectangle(8, 13, 50, 24));
            jLabel1.setText("Name：");
            jPanel1 = new JPanel();
            jPanel1.setLayout(null);
            jPanel1.add(jLabel1, null);
            jPanel1.add(getSname(), null);
            jPanel1.add(searchButton(), null);
            jPanel1.add(deleteButton(), null);
            jPanel1.add(getJScrollPane1(), null);
        }
        return jPanel1;
    }

    /**
     * This method initializes jPanel1 for add song
     * @return java.swing.JPanel
     */
    private JPanel getJPanel2() {
        if (jPanel2 == null) {
            jPanel2 = new JPanel();
            jPanel2 = new JPanel(new GridLayout(7, 2));
            jLabel2 = new JLabel("                 Song number");
            jLabel3 = new JLabel("                 Song name");
            jLabel4 = new JLabel("                 Song artist");
            jLabel5 = new JLabel("                 Song duration");
            jLabel6 = new JLabel("                 Song album");
            jLabel7 = new JLabel("                 Year");
            addbtn = new JButton("Add");
            resetbtn = new JButton("Rest");

            number = new JTextField(20);
            sname2 = new JTextField(20);
            artist = new JTextField(20);
            duration = new JTextField(20);
            album = new JTextField(20);
            year = new JTextField(20);

            jPanel2.add(jLabel2, null);
            jPanel2.add(number, null);
            jPanel2.add(jLabel3, null);
            jPanel2.add(sname2, null);
            jPanel2.add(jLabel4, null);
            jPanel2.add(artist, null);
            jPanel2.add(jLabel5, null);
            jPanel2.add(duration, null);
            jPanel2.add(jLabel6, null);
            jPanel2.add(album, null);
            jPanel2.add(jLabel7, null);
            jPanel2.add(year, null);
            jPanel2.add(addbtn, null);
            jPanel2.add(resetbtn, null);
            resetbtn.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent ae) {
                    number.setText("");
                    sname2.setText("");
                    artist.setText("");
                    duration.setText("");
                    album.setText("");
                    year.setText("");
                }
            });
            addbtn.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent ae) {
                    String value1 = number.getText();
                    String value2 = sname2.getText();
                    String value3 = artist.getText();
                    String value4 = duration.getText();
                    String value5 = album.getText();
                    String value6 = year.getText();
                    try {

                        Class.forName("com.mysql.jdbc.Driver").newInstance();
                        String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                        Connection con = DriverManager.getConnection(URL);
                        Statement st = con.createStatement();
                        String s = "INSERT INTO songs(number,sname,artist,duration,album,year) VALUES ('" + Integer.parseInt(value1) + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "','" + value6 + "')";
                        st.executeUpdate(s);
                        JOptionPane.showMessageDialog(jPanel2, "Add song successfully.");
                        //con.close();
                    } catch (Exception e) {
                        JOptionPane.showMessageDialog(jPanel2, "Error in submitting data!");
                    }
                }
            });
        }
        return jPanel2;
    }

    private JPanel getJPanel3() {
        if (jPanel3 == null) {
            jLabel8 = new JLabel();
            jLabel8.setBounds(new Rectangle(38, 225, 50, 24));
            jLabel8.setText("Artist：");
            jLabel9 = new JLabel();
            jLabel9.setBounds(new Rectangle(38, 13, 50, 24));
            jLabel9.setText("Name：");
            jLabel10 = new JLabel();
            jLabel10.setBounds(new Rectangle(38, 260, 50, 24));
            jLabel10.setText("Name:");//the label of song name to delete
            jLabel11 = new JLabel();
            jLabel11.setBounds(new Rectangle(220, 225, 50, 24));
            jLabel11.setText("Album：");
            jLabel12 = new JLabel();
            jLabel12.setBounds(new Rectangle(220, 260, 50, 24));
            jLabel12.setText("Year：");

            jPanel3 = new JPanel();
            jPanel3.setLayout(null);
            jPanel3.add(jLabel9, null);
            jPanel3.add(getSname3(), null);
            jPanel3.add(jLabel8, null);
            jPanel3.add(getArtist1(), null);
            jPanel3.add(jLabel10, null);
            jPanel3.add(getSname4(), null);
            jPanel3.add(jLabel11, null);
            jPanel3.add(getAlbum1(), null);
            jPanel3.add(selectButton(), null);
            jPanel3.add(jLabel12, null);
            jPanel3.add(getYear1(), null);
            jPanel3.add(editButton(), null);
            jPanel3.add(exitButton(), null);
            jPanel3.add(getJScrollPane3(), null);
        }
        return jPanel3;
    }

    /**
     * This method initializes jScrollPane1
     * @return javax.swing.JScrollPane
     */
    private JScrollPane getJScrollPane1() {
        if (jScrollPane1 == null) {
            jScrollPane1 = new JScrollPane();
            jScrollPane1.setBounds(new Rectangle(8, 45, 570, 255));
            jScrollPane1.setViewportView(getJTable1());
        }
        return jScrollPane1;
    }

    /**
     * This method initializes jScrollPane3
     * @return javax.swing.JScrollPane
     */
    private JScrollPane getJScrollPane3() {
        if (jScrollPane3 == null) {
            jScrollPane3 = new JScrollPane();
            jScrollPane3.setBounds(new Rectangle(8, 45, 570, 170));
            jScrollPane3.setViewportView(getJTable2());
        }
        return jScrollPane3;
    }

    /**
     * This method initializes jTable1 in jpanel1---songInformation
     * @return javax.swing.JTable
     */
    private JTable getJTable1() {
        if (jTable1 == null) {
            try {
                Class.forName("com.mysql.jdbc.Driver");
                String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                Connection con = DriverManager.getConnection(URL);
                Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                String SQLOrder = "SELECT number,sname,artist,duration,album,year FROM songs WHERE songs.sname=songs.sname";
                ResultSet rs = st.executeQuery(SQLOrder);
                rs.last();
                int count = rs.getRow();
                rs.first();
                int i = 0;
                this.p1 = new Object[count][6];
                do {

                    String number = rs.getString(1);
                    String sname = rs.getString(2);
                    String artist = rs.getString(3);
                    String duration = rs.getString(4);
                    String album = rs.getString(5);
                    String year = rs.getString(6);
                    i++;
                } while (rs.next());
                st.close();
                //con.close();
            } catch (Exception ex) {
                //JOptionPane.showMessageDialog(null, "Connection library error！", "Hint", JOptionPane.ERROR_MESSAGE);
            }
            jTable1 = new JTable();
            /*****************************Realize banned editor****************************/
            t1 = new DefaultTableModel(p1, column1) {

                private static final long serialVersionUID = 1L;

                public boolean isCellEditable(int row, int column1) {
                    return true;
                }
            };

            jTable1.setModel(t1);
            /******************************************************************/
            jTable1.setPreferredScrollableViewportSize(new Dimension(500, 150));
            jTable1.setBounds(new Rectangle(0, 0, 350, 200));
            jTable1.setPreferredSize(new Dimension(475, 300));
            jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
            //use the method of getColumn() from TableColumnModel interface to get
            jTable1.addMouseListener(new java.awt.event.MouseAdapter() {

                public void mouseClicked(java.awt.event.MouseEvent e) {
                    try {
                        sname1.setText(jTable1.getValueAt(jTable1.getSelectedRow(), 1).toString());
                    } catch (NullPointerException n) {
                    }
                }
            });
        }
        return jTable1;
    }

    /**
     * This method initializes jTable2
     * @return java.swing.JTable
     */
    private JTable getJTable2() {
        if (jTable2 == null) {
            try {
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                Connection con = DriverManager.getConnection(URL);
                Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                String SQLOrder = "SELECT * FROM songs";
                ResultSet rs = st.executeQuery(SQLOrder);
                rs.last();
                int count = rs.getRow();
                rs.first();
                int i = 0;
                this.p3 = new Object[count][6];
                do {

                    String number = rs.getString(1);
                    String sname3 = rs.getString(2);
                    String artist = rs.getString(3);
                    String duration = rs.getString(4);
                    String album = rs.getString(5);
                    String year = rs.getString(6);

                    i++;
                } while (rs.next());
                st.close();
                //con.close();
            } catch (Exception ex) {
            }
            jTable2 = new JTable();
            /*****************************Realize banned editor****************************/
            t3 = new DefaultTableModel(p3, column3) {

                private static final long serialVersionUID = 1L;

                public boolean isCellEditable(int row, int column) {
                    return false;
                }
            };

            jTable2.setModel(t3);
            /******************************************************************/
            jTable2.setPreferredScrollableViewportSize(new Dimension(510, 40));
            jTable2.setBounds(new Rectangle(0, 0, 350, 200));
            jTable2.setPreferredSize(new Dimension(375, 200));
            jTable2.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
            jTable2.addMouseListener(new java.awt.event.MouseAdapter() {

                public void mouseClicked(java.awt.event.MouseEvent e) {
                    try {
                        sname3.setText(jTable2.getValueAt(jTable2.getSelectedRow(), 1).toString());
                        artist1.setText(jTable2.getValueAt(jTable2.getSelectedRow(), 2).toString());
                        sname4.setText(jTable2.getValueAt(jTable2.getSelectedRow(), 1).toString());
                        album1.setText(jTable2.getValueAt(jTable2.getSelectedRow(), 4).toString());
                        year1.setText(jTable2.getValueAt(jTable2.getSelectedRow(), 5).toString());
                    } catch (NullPointerException n) {
                    }
                }
            });
        }
        return jTable2;
    }

    /**
     * This method initializes jButton for search song information
     * @return javax.swing.JButton
     */
    private JButton searchButton() {
        if (searchbtn == null) {
            searchbtn = new JButton();
            searchbtn.setBounds(new Rectangle(209, 13, 80, 24));
            searchbtn.setText("Search");
            searchbtn.addActionListener(new java.awt.event.ActionListener() {

                public void actionPerformed(java.awt.event.ActionEvent e) {
                    try {
                        Class.forName("com.mysql.jdbc.Driver").newInstance();
                        String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                        Connection c = DriverManager.getConnection(URL);
                        Statement st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                        String name = sname1.getText().trim();
                        String SQLOrder;
                        if (name.equals("both")) {
                            SQLOrder = "SELECT * FROM songs";
                        } else {
                            SQLOrder = "SELECT * FROM songs WHERE sname='" + name + "'";
                        }
                        ResultSet rs = st.executeQuery(SQLOrder);
                        rs.last();
                        int count = rs.getRow();
                        rs.first();
                        int i = 0;
                        p1 = new Object[count][6];
                        do {

                            String number = rs.getString(1);
                            String sname = rs.getString(2);
                            String artist = rs.getString(3);
                            String duration = rs.getString(4);
                            String album = rs.getString(5);
                            String year = rs.getString(6);
                            p1[i][0] = number;
                            p1[i][1] = sname;
                            p1[i][2] = artist;
                            p1[i][3] = duration;
                            p1[i][4] = album;
                            p1[i][5] = year;
                            i++;
                        } while (rs.next());
                        st.close();
                        // c.close();
                        jTable1.repaint();
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(null, "Connection song library error！", "Hint", JOptionPane.ERROR_MESSAGE);
                    }
                    /*****************************Realize banned editor****************************/
                    t1 = new DefaultTableModel(p1, column1) {

                        // private static final long serialVersionUID = 1L;
                        public boolean isCellEditable(int row, int column1) {
                            return false;
                        }
                    };

                    jTable1.setModel(t1);
                    /******************************************************************/
                    jTable1.setPreferredScrollableViewportSize(new Dimension(550, 100));
                    jTable1.setBounds(new Rectangle(0, 0, 350, 250));
                    jTable1.setPreferredSize(new Dimension(375, 250));
                    jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
                }
            });
        }
        return searchbtn;
    }

    /**
     * This method initializes jButton for delete song
     * @return javax.swing.JButton
     */
    private JButton deleteButton() {
        if (deletebtn == null) {
            deletebtn = new JButton();
            deletebtn.setBounds(new Rectangle(320, 13, 80, 24));
            deletebtn.setText("Delete");
            deletebtn.addMouseListener(new java.awt.event.MouseAdapter() {

                public void mouseClicked(java.awt.event.MouseEvent e) {
                    if (sname1.getText() == null) {
                        JOptionPane.showMessageDialog(null, "please choose the song to delete！", "Hint", JOptionPane.INFORMATION_MESSAGE);
                    } else {
                        String value1 = jTable1.getValueAt(jTable1.getSelectedRow(), 1).toString();

                        try {
                            Class.forName("com.mysql.jdbc.Driver").newInstance();
                            String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                            Connection c = DriverManager.getConnection(URL);
                            Statement st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                            String sql = "DELETE FROM songs WHERE sname ='" + value1 + "'";
                            st.executeUpdate(sql);
                            st.close();
                            //c.close();
                            t1.removeRow(jTable1.getSelectedRow());
                            JOptionPane.showMessageDialog(null, "Delete successful！", "Hint", JOptionPane.INFORMATION_MESSAGE);
                        } catch (Exception ex) {
                        }
                    }
                }
            });
        }
        return deletebtn;
    }

    /**
     * This method initializes jButton for searching song in edit panel
     * @return javax.swing.JButton
     */
    private JButton selectButton() {
        if (selectbtn == null) {
            selectbtn = new JButton();
            selectbtn.setBounds(new Rectangle(239, 13, 100, 24));
            selectbtn.setText("Search");
            selectbtn.addActionListener(new java.awt.event.ActionListener() {

                public void actionPerformed(java.awt.event.ActionEvent e) {
                    artist1.setText("");
                    sname4.setText("");
                    album1.setText("");
                    year1.setText("");
                    try {

                        Class.forName("com.mysql.jdbc.Driver").newInstance();
                        String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                        Connection con = DriverManager.getConnection(URL);
                        Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                        String name1 = sname3.getText().trim();
                        String SQLOrder;
                        if (name1.equals("both")) {
                            SQLOrder = "SELECT * FROM songs";
                        } else {
                            SQLOrder = "SELECT * FROM songs WHERE sname='" + name1 + "'";
                        }

                        ResultSet rs = st.executeQuery(SQLOrder);
                        rs.last();
                        int count = rs.getRow();
                        rs.first();
                        int i = 0;
                        p3 = new Object[count][6];
                        do {
                            String number = rs.getString(1);
                            String sname = rs.getString(2);
                            String artist = rs.getString(3);
                            String duration = rs.getString(4);
                            String album = rs.getString(5);
                            String year = rs.getString(6);
                            p3[i][0] = number;
                            p3[i][1] = sname;
                            p3[i][2] = artist;
                            p3[i][3] = duration;
                            p3[i][4] = album;
                            p3[i][5] = year;
                            i++;
                        } while (rs.next());
                        st.close();
                        //con.close();
                        jTable2.repaint();
                    } catch (Exception ex) {
                    }
                    /*****************************Realize banned editor****************************/
                    t3 = new DefaultTableModel(p3, column3) {

                        private static final long serialVersionUID = 1L;

                        public boolean isCellEditable(int row, int column) {
                            return false;
                        }
                    };

                    jTable2.setModel(t3);
                    /******************************************************************/
                    jTable2.setPreferredScrollableViewportSize(new Dimension(510, 40));
                    jTable2.setBounds(new Rectangle(0, 0, 350, 200));
                    jTable2.setPreferredSize(new Dimension(375, 200));
                    jTable2.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
                }

                ;
            });
            selectbtn.addMouseListener(new java.awt.event.MouseAdapter() {

                public void mouseClicked(java.awt.event.MouseEvent e) {
                }

                ;
            });
        }
        return selectbtn;
    }

    private JButton editButton() {
        if (editbtn == null) {
            editbtn = new JButton();
            editbtn.setBounds(new Rectangle(431, 225, 60, 24));
            editbtn.setText("Edit");
            editbtn.addMouseListener(new java.awt.event.MouseAdapter() {

                public void mouseClicked(java.awt.event.MouseEvent e) {
                    if ((sname3.getText()) == null || (sname3.getText().trim()).equals("") || (sname3.getText().trim()).equals("both")) {
                        JOptionPane.showMessageDialog(null, "select the artist！", "Notice", JOptionPane.INFORMATION_MESSAGE);
                    } else {
                        String sname3 = jTable2.getValueAt(jTable2.getSelectedRow(), 1).toString();

                        String artist = artist1.getText().trim();
                        String name = sname4.getText().trim();
                        String album = album1.getText().trim();
                        String year = year1.getText().trim();

                        try {

                            Class.forName("com.mysql.jdbc.Driver").newInstance();
                            String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP1?user=DA5221_GRP1&password=94b85e";
                            Connection con = DriverManager.getConnection(URL);
                            Statement st = con.createStatement();
                            String SQLOrder = "UPDATE songs SET artist='" + artist + "', sname='" + name + "', album='" + album + "', year='" + year + "'WHERE sname='" + sname3 + "'";
                            st.executeUpdate(SQLOrder);
                            st.close();
                            con.close();
                            JOptionPane.showMessageDialog(null, "Edit successful！", "Hint", JOptionPane.INFORMATION_MESSAGE);

                            jTable2.setValueAt(artist, jTable2.getSelectedRow(), 2);
                            jTable2.setValueAt(name, jTable2.getSelectedRow(), 1);
                            jTable2.setValueAt(album, jTable2.getSelectedRow(), 4);
                            jTable2.setValueAt(year, jTable2.getSelectedRow(), 5);
                        } catch (Exception ex) {
                        }
                    }
                }
            });
        }
        return editbtn;
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                player thisClass = new player();
                thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                thisClass.setVisible(true);
            }
        });
    }

    // This is the default constructor
    public player() {
        super();
        initialize();
    }

//the method is to set the window size,title and contentPane
    private void initialize() {
        this.setSize(630, 400);
        this.setContentPane(getJContentPane());
        this.setTitle("Personal Song Library");
    }

    /**
     * This method initializes jContentPane
     * @return javax.swing.JPanel
     */
    private JPanel getJContentPane() {
        if (jContentPane == null) {
            jContentPane = new JPanel();
            jContentPane.setLayout(null);
            jContentPane.add(getJPanel(), null);
            jContentPane.add(getJTabbedPane(), null);
        }
        return jContentPane;
    }

    private JTextField getSname() {
        if (sname1 == null) {
            sname1 = new JTextField();
            sname1.setBounds(new Rectangle(72, 13, 110, 24));
        }
        return sname1;
    }

    private JTextField getArtist1() {
        if (artist1 == null) {
            artist1 = new JTextField();
            artist1.setBounds(new Rectangle(102, 225, 110, 24));
        }
        return artist1;
    }

    private JTextField getSname3() {
        if (sname3 == null) {
            sname3 = new JTextField();
            sname3.setBounds(new Rectangle(102, 13, 110, 24));
        }
        return sname3;
    }

    private JTextField getSname4() {
        if (sname4 == null) {
            sname4 = new JTextField();
            sname4.setBounds(new Rectangle(102, 260, 110, 24));
        }
        return sname4;
    }

    private JTextField getAlbum1() {
        if (album1 == null) {
            album1 = new JTextField();
            album1.setBounds(new Rectangle(280, 225, 110, 24));
        }
        return album1;
    }

    private JTextField getYear1() {
        if (year1 == null) {
            year1 = new JTextField();
            year1.setBounds(new Rectangle(280, 260, 110, 24));
        }
        return year1;
    }

    private JButton exitButton() {
        if (exitbtn == null) {
            exitbtn = new JButton();
            exitbtn.setBounds(new Rectangle(431, 260, 60, 24));
            exitbtn.setText("Exit");
            exitbtn.addActionListener(new java.awt.event.ActionListener() {

                public void actionPerformed(java.awt.event.ActionEvent e) {
                    System.exit(0);
                }
            });
        }
        return exitbtn;
    }
}  


